using System.Collections;
using System.Collections.Generic;
using Cinemachine;
using UnityEngine;

public class StepTrigger : TriggerBase
{
    [SerializeField] private CinemachineVirtualCamera _startSwitchCamera;
    [SerializeField] private CinemachineVirtualCamera _targetSwitchCamera;
    protected override void OnTriggerEnter2D(Collider2D other)
    {
        base.OnTriggerEnter2D(other);

        if (other.CompareTag("Player") == false)
            return;

        CameraManager.Instance.SwapCamera(_targetSwitchCamera);
    }
    protected override void OnTriggerExit2D(Collider2D other)
    {
        base.OnTriggerExit2D(other);

        if (other.CompareTag("Player") == false)
            return;
        if (other.transform.position.x - _coll.bounds.center.x < 0)
            CameraManager.Instance.SwapCamera(_startSwitchCamera);
    }
}
